<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>核销管理</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <%@include file="/WEB-INF/pages/common/taglib.jsp" %>
    <%@include file="/WEB-INF/pages/common/common.jsp" %>
    <style type="text/css">
        #corptable td:first-child {
            vertical-align: middle !important;
        }

        .ui-jqgrid-hbox th {
            vertical-align: middle !important;
        }

        td input[type='checkbox'] {
            height: 100%;
        }
    </style>
</head>
<body>
<div class="content content_frame">
    <h3 class="mainTitle"><img src="${basePath}/images/icon2.png"/>核销查询</h3>
    </br>
    <ul class="contentNav dib-wrap">
        <li class="dib" id="btnSearch" defaultkey='13'>
            <a onclick="$._options._query('corptable','queryList')"><i class='fa fa-search'></i>&nbsp;&nbsp;查&nbsp;询
            </a>
        </li>
        <li class="dib">
            <a onclick="$._options._add($basePath + '/exportB2C/cancelBill/toAddPage')"><i class='fa fa-search'></i>&nbsp;&nbsp;新&nbsp;增
            </a>
        </li>
        <li class="dib">
            <a onclick="$._options._edit($basePath + '/exportB2C/cancelBill/toEditPage','corptable','id')"><i
                    class='fa fa-edit'></i>&nbsp;&nbsp;修&nbsp;改 </a>
        </li>
        <li class="dib">
            <a onclick="deleteRow()"><i class='fa fa-search'></i>&nbsp;&nbsp;删&nbsp;除 </a>
        </li>
        <li class="dib ">
            <a onclick="ClearAllInput('SearchTable')">
                <i class='fa fa-refresh'></i>&nbsp;&nbsp;重&nbsp;置 </a>
        </li>
    </ul>
    <br/>
    <table id="SearchTable" width="100%" class="table1">
        <tr>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            手册编号
                        </td>
                        <td class="tdCss">
                            <input type="text" class="input1" datafield="SearchTable.eBillingNo" placeholder="手册编号"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            企业内部编码
                        </td>
                        <td class="tdCss">
                            <input type="text" class="input1" datafield="SearchTable.entEBillingNo"
                                   placeholder="企业内部编码"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            申报日期
                        </td>
                        <td class="tdCss">
                            <input type="text" class="input1 Wdate" datafield="SearchTable.declDateStart"
                                   id="declDateStart"
                                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',maxDate:'#F{$dp.$D(\'declDateEnd\')}'})"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td style="width: 25%;">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            至
                        </td>
                        <td class="tdCss">
                            <input type="text" class="input1 Wdate" datafield="SearchTable.declDateEnd"
                                   id="declDateEnd"
                                   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'#F{$dp.$D(\'declDateStart\')}'})">
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                    <tr>
                        <td class="titleCss">
                            报核状态
                        </td>
                        <td class="tdCss">
                            <ui:tsingletableautocomplete
                                    key="ITEM_KEY"
                                    value="ITEM_VALUE"
                                    tableName="DICT_ITEM"
                                    groupId="VARIFY_EBILL_STATUS"
                                    keyFieldName="sendStatus"
                                    valueFieldName="sendStatusXXX"/>
                        </td>
                    </tr>
                </table>
            </td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
    </table>
    <div class="cl"></div>
    <br/>
    <table id="corptable" style="height: 1px">
    </table>
    <div id="corptablePage">
    </div>
</div>
<script type="text/javascript">
    function deleteRow() {
        $._options._delete($basePath + '/exportB2C/cancelBill/delete', 'corptable', 'id',function(){
            $._options._reload('corptable', '${basePath}/exportB2C/cancelBill/queryList');
        });
    }

    function detail(cellvalue, options, rowObject) {
        return $._options._detail($basePath + '/exportB2C/cancelBill/showDetail?id=' + rowObject['id'], $.trim(cellvalue || ''));
    }

    function ieFlag(cellvalue, options, rowObject) {
        return $._options._dictName($.trim(cellvalue || ''), {"I": "进口", "E": "出口"});
    }

    function statusC(cellvalue, options, rowObject) {
        return $._options._status(rowObject["sendStatus"], $.trim(cellvalue || ''),
                {
                    "E1": {
                        _css: {padding: "3px 3px"},
                        _class: "label label-info"
                    },
                    "2": {
                        _css: {padding: "3px 3px"},
                        _class: "label label-success"
                    },
                    "3": {
                        _css: {padding: "3px 3px"},
                        _class: "label label-primary"
                    },
                    "4": {
                        _css: {padding: "3px 3px"},
                        _class: "label label-danger"
                    }
                });
    }

    $(function () {
        $("#corptable").jqGrid({
            datatype: "json",
            url: "queryList",
            colNames: [
                'id',
                '企业内部编码',
                '手册编号',
                '经营单位名称',
                '报核类型',
                '申报日期',
                '数据报核状态编码',
                '数据报核状态'
            ],
            colModel: [
                {name: 'id', index: 'id', hidden: true},
                {name: 'entEBillingNo', index: 'entEBillingNo', formatter: detail},
                {name: 'eBillingNo', index: 'eBillingNo'},
                {name: 'enterpriseName', index: 'enterpriseName'},
                {name: 'decType', index: 'decType'},
                {name: 'declDate', index: 'declDate'},
                {name: 'sendStatus', index: 'sendStatus', hidden: true},
                {name: 'sendStatusDisplay', index: 'sendStatusDisplay', formatter: statusC}
            ],
            viewrecords: true, // show the current page, data rang and total records on the toolbar
            autowidth: true,
            height: 'auto',
            shrinkToFit: false,
            autoScroll: true,
            rowNum: 10, //每页显示记录数
            rowList: [10, 20, 100], //可调整每页显示的记录数
            rownumbers: true,
            rownumWidth: 20,
            multiselect: true,
            pager: "#corptablePage", //分页工具栏
            sortname: "createDate",
            sortorder: "desc",
            loadComplete: function () {
                var rowNum = $(this).jqGrid('getGridParam', 'records');
                if (rowNum <= 0) {
                    if ($(this).parent().children('.norecords').length == 0)
                        $(this).parent().append("<div class=\"norecords\">暂无数据！</div>");
                    $(this).parent().children('.norecords').show();
                }
                else {//如果存在记录，则隐藏提示信息。
                    $(this).parent().children('.norecords').hide();
                }
                $("#corptable").setGridWidth($(window).width() - 30);
                $(".ui-jqgrid tr.ui-row-ltr td").css('text-align', 'center');
            }
        });

        $(window).resize(function () {
            $("#corptable").setGridWidth($(window).width() - 30);
        });
    });
</script>
</body>
</html>
